package calculators;

import algorithm.AlgorithmParameters;
import utils.Position;
import utils.PositionMath;

public class TendencyCalculator {
    private final PositionMath positionMath = new PositionMath();
    static final double e = 0.001;

    Position calculateRelatedPosition(Position neighbour, Position krill) {
        Position related = positionMath.subPositions(neighbour, krill);
        return positionMath.dividePositionByScalar(related, positionMath.determineDistance(neighbour, krill) + e);
    }

    double calculateRelatedFitness(double neighbourFitness, double krillFintess, AlgorithmParameters parameters) {
        return (krillFintess - neighbourFitness) / parameters.getRelatedFitnessValue();
    }
}